﻿using ApiDoc.Models.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace ApiDoc.Models
{ 
    public class ApiModel : BaseModel
    {
        private string title; 
        public string Title
        {
            get { return title; }
            set { title = value;
                base.OnPropertyChanged("Title");
            }
        }

        private string url; 
        public string Url
        {
            get { return url; }
            set { url = value;
                base.OnPropertyChanged("Url");
            }
        }
 
        private string method = "Post"; 
        public string Method
        {
            get {
                return method;
            }
            set {
                this.method = value;
                base.OnPropertyChanged("Method");
            }
        }


        public int FKSN { get; set; }

        private string serializeType = "Json"; 
        public string SerializeType // 数据格式:xml , json
        {
            get => serializeType;
            set
            {
                serializeType = value;
                base.OnPropertyChanged("SerializeType");
            }
        }
  
        private string executeType = "DataSet";
        // 结果集: Int, Scalar, DataSet
        public string ExecuteType
        {
            get { return executeType; }
            set { executeType = value;
                base.OnPropertyChanged("ExecuteType");
            }
        }

        private bool isTransaction = false; 
        public bool IsTransaction
        {
            get { return isTransaction; }
            set { isTransaction = value;
                base.OnPropertyChanged("IsTransaction");
            }
        }

        private bool isJms  = false;
        //分布式类型是否为Jms
        public bool IsJms
        {
            get { return isJms; }
            set { isJms = value;
                base.OnPropertyChanged("IsJms");
            }
        }

        private bool isStop;
        //是否停用
        public bool IsStop
        {
            get { return isStop; }
            set { isStop = value;
                base.OnPropertyChanged("IsStop");
            }
        }

        private string dataType = "SqlServer";
        /// <summary>
        /// 数据库，SqlServer, Oracle, MySql
        /// </summary>
        public string DataType
        {
            get { return dataType; }
            set { dataType = value;
                base.OnPropertyChanged("DataType");
            }
        }
       
        public List<FlowStepModel> Steps;
        public string Auth;// 验证接口参数是否正确

        private int tranType = 0;
        /// <summary>
        /// 0:事务 无 1:单机事务 2:分布式事务
        /// </summary>
        public int TranType
        {
            get { return tranType; }
            set { tranType = value;
                base.OnPropertyChanged("TranType");
            }
        }

    }
}
